<?php
/**
 * Created by PhpStorm.
 * User: yxs
 * Date: 2017/4/18
 * Time: 11:01
 */

namespace model;
use think\Model;

class Admin extends Model
{
    
    protected $insert = ['reg_ip',"reg_time","password"];
    protected $update = ['last_login_time',"last_login_ip"];


    public function setPasswordAttr($value){
        return md5($value);
    }

    public function setRegIpAttr(){
        return request()->ip();
    }

    public function setRegTimeAttr(){
        return time();
    }

    public function setLastLoginTimeAttr(){
        return time();
    }

    public function setLastLoginIpAttr(){
        return request()->ip();
    }

}